package com.xiaoming.mojbackenduserservice.controller.inner;

import com.xiaoming.mojbackendmodel.model.entity.User;
import com.xiaoming.mojbackenduserservice.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

@RestController
@RequestMapping("/inner")
public class UserInnerController {
    @Resource
    private UserService userService;
    @GetMapping("/get/id")
    public User getById(@RequestParam("userId") Long userId)
    {
        User user = userService.getById(userId);
        return user;
    }

    @GetMapping("/get/ids")
    public List<User> listByIds(@RequestParam("idList") Collection<Long> idList)
    {
        List<User> userList = userService.listByIds(idList);
        return userList;
    }

}
